package com.sylli.oeuf.server.game.logic.invocation;

import com.sylli.oeuf.server.game.logic.BattleActor;
import com.sylli.oeuf.server.game.logic.CastingTarget;
import com.sylli.oeuf.server.game.logic.EventParameter;

public abstract class WatchValueInvocationCondition extends InvocationCondition {
	
	private boolean isCheckGreaterThan;
	
	private int againstValue;
	
	public WatchValueInvocationCondition(boolean isCheckGreaterThan, int againstValue) {
		this.isCheckGreaterThan = isCheckGreaterThan;
		this.againstValue = againstValue;
	}
	
	public abstract int getCurrentValue(int invocationRank, BattleActor caster);
	
	@Override
	public boolean shouldInvoke(int invocationRank, BattleActor caster, CastingTarget target, EventParameter param) {
		int currentValue = getCurrentValue(invocationRank, caster);
		return ((currentValue > againstValue) && isCheckGreaterThan)
			|| ((currentValue < againstValue) && !isCheckGreaterThan);
	}	
	
}
